
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>调试模块 - Enveesoft </title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Le styles -->
        <link href="/brave/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/brave/css/style.css" media="screen" rel="stylesheet" type="text/css">
<link href="/brave/css/bootstrap-responsive.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/brave/css/jquery-ui/jquery-ui.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/brave/img/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
        <!-- Scripts -->
        <script type="text/javascript" src="/brave/js/jquery.min.js"></script>
<script type="text/javascript" src="/brave/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="/brave/js/json2.js"></script>
    </head>
    <body>
	<form method='POST'>
	<table class="table">
		<tr><th>微信脚本路径：</th><td><input type='text' name='uri' value='index.php' /></td></tr>
		<tr><th>开发者微信号：</th><td><input type='text' name='to_user_name' value='atGooth' /></td></tr>
		<tr><th>发送方账号（一个OpenID）：</th><td><input type='text' name='from_user_name' value='atGooth' /></td></tr>
		<tr><th>消息创建时间戳（整型）：</th><td><input type='text' name='timestamp' value='1348831860' /></td></tr>
		<tr><th>消息类型（text）：</th><td><input type='text' name='type' value='text' /></td></tr>
		<tr><th>文本内容：</th><td><input type='text' name='content' value='浆洗街站 93' /></td></tr>
		<tr><th>消息id（64位整型）：</th><td><input type='text' name='id' value='1234567890123456' /></td></tr>
	</table>
		<input type='button' id='submit' value='发送消息' onclick='send_request(this.form);' />
		<input type='button' id='clear' value='清空调试台' onclick='clear_response();' />
	</form>
<div id='wxresponse'></div>
<script type='text/javascript'>
function clear_response()
{
	$('#wxresponse').html('');
}
function send_request(myform)
{
	request = build_text_request(
			myform.to_user_name.value,
			myform.from_user_name.value,
			myform.content.value
			);
	$('#wxresponse').html('正在处理ing');
	$(':button').attr('disabled', true);
	$.post(myform.uri.value, request, function(data){
			content = $('Content',data);
			$('#wxresponse').html('<pre>'+content.text()+'</pre>');
			//$('#wxresponse').append('<p>↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑</p>');
			$(':button').removeAttr('disabled');
			}, 'xml');
}

function build_text_request(to, from, content)
{
	return "<xml>"+
		"<ToUserName><![CDATA["+to+"]]></ToUserName>"+
 "<FromUserName><![CDATA["+from+"]]></FromUserName>"+
 "<CreateTime>1348831860</CreateTime>"+
 "<MsgType><![CDATA[text]]></MsgType>"+
 "<Content><![CDATA["+content+"]]></Content>"+
 "<MsgId>1234567890123456</MsgId>"+
 "</xml>";
}
</script>
    </body>
</html>

